package com.minimoment.model.service.impl;

import com.minimoment.base.BaseSupportImpl;
import com.minimoment.model.domain.MovieNews;
import com.minimoment.model.service.MovieNewsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by etund on 2014/11/1.
 */
@Service
@Transactional
@SuppressWarnings("all")
public class MovieNewsServiceImpl extends BaseSupportImpl<MovieNews> implements MovieNewsService {

    @Override
    public List<MovieNews> findBest(int i) {
        List<MovieNews> movieNewses = new ArrayList<MovieNews>();
        movieNewses = findAll();
        return movieNewses;
    }

    @Override
    public List<MovieNews> findTop(int items) {
        list = this.getSession().createQuery("from MovieNews mn order by mn.littles.size desc ").setMaxResults(items).list();
        return list;
    }
}
